<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>          
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
    <meta content="yes" name="apple-mobile-web-app-capable" />     
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />     
    <meta content="telephone=no" name="format-detection" />
    <link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
	<link href="../assets/mobile/single.css" rel="stylesheet" type="text/css" />
	<script src="../assets/js/mobile/jquery190.js" type="text/javascript"></script>
	<script src="../script/jquery.cookie.js" type="text/javascript"></script>
	<link rel="stylesheet" href="../assets/mobile/top.css">
	<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
	<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
	<link rel="stylesheet" href="../assets/agile/css/flat/flat.color.css">
	<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/config.js"></script>
	<script type="text/javascript" src="../script/local.js"></script>
	<script type="text/javascript" src="../script/common.js"></script>
</head>
<body style="position: static;">

<!--通用顶部-->

<!--通用顶部结束-->


<div class="h5-1yyg-v1">
    
<!-- 栏目页面顶部 -->
<!-- 内页顶部 -->
		<div id="wrapper" style="position:static;">
        <section class="clearfix g-share-lucky" style="margin-top:10px !important;">        
			<!-- <s class="z-Reward"></s> -->
			<a class="fl u-lucky-img userindex" userindex="" href="javascript:;"><img class="lazy" border="0" alt="" data-original=""></a>
			<div class="u-lucky-r">
			<p>幸运获得者：<a href="javascript:;" userindex="" class="z-user blue userindex q_username">加载中...</a></p>
			<p>幸运夺宝码：<em class="orange q_user_code">加载中...</em></p>
			<p>本期夺宝：<em class="orange gonumber">加载中...</em>人次</p>
			<p>揭晓时间：<em class="arial opentime">00:00:00</em></p> 
			</div>                
        </section>
        <!-- 热门推荐 -->
        <section class="clearfix g-share-ct" style="margin-top:0px !important;">		
	        <b class="z-aw-es z-arrow"></b>	
	        <article class="m-share-con">
		        <h2 class="sd_title">加载中...</h2>
		        <em class="arial sd_time">加载中...</em>
		        <p class="z-share-pad" id="shareContent">加载中...</p>	        
	        </article>
            <div class="m-share-fixed">
                <div id="CommentNav"> 
                    <div class="m-share-btn">
                        <div id="divtest" class="u-btn-w"><a id="emHits" class="z-btn-mood"><s></s>羡慕嫉妒恨(<em class="sd_zhan">加载中...</em>)</a></div>
                        <div class="u-btn-w"><a id="btnComment" href="javascript:void(0);" class="z-btn-comment"><s></s>我要评论</a></div>
                        <div class="u-btn-w" style="display:none;"><a id="btnShare" href="javascript:void(0);" class="z-btn-Share"><s></s>分享</a></div>
                    </div>
                    <div class="m-comment" style="display:none;">
                        <div class="u-comment ">
                            <textarea name="comment" id="comment" rows="3" class="z-comment-txt" ></textarea>
                        </div>
                        <div class="u-Btn">
                            <div class="u-Btn-li"><a id="btnCancel" href="javascript:;" class="z-CloseBtn">取 消</a></div>
                            <div class="u-Btn-li"><a id="btnPublish" href="javascript:;" class="z-DefineBtn">发表评论</a></div>
                        </div>
                    </div>
                    <div class="m-shareT-round"></div>
                </div>
                <div id="fillDiv" style="display:none;"></div>
            </div>        
            <article class="m-share-comment m-round">
                <h3>共<span id="ReplyCount"  class="z-user orange">加载中...</span>条评论</h3>
                <ul id="replyList">&nbsp;&nbsp;加载中...</ul>
                <a id="btnLoadMore" class="loading" href="javascript:void(0);" style="display:none;">点击加载更多</a>
                <div id="divLoading" class="loading"style="display:none;"><b></b>正在加载</div>
            </article>
        </section>

</div>

<script type="text/javascript">
apiready = function(){
$(function(){
	var userinfo = getUserinfo();
	var sd_id = localData.get('sd_id');
	if(!sd_id || isNaN(parseInt(sd_id))){
		$.PageDialog.fail("数据不存在");
		api.closeWin({name:'sddetail'});
		return;
	};
	
	GetJPData(config.url+'/app.php?act=sddetail',{sd_id:sd_id},function(data){
		if(data['status'] == 1){
			$('.userindex').attr('userindex',data['data']['sd_userid']);
			$('.userindex img').attr('data-original',config.upload_url+'/'+data['data']['u_thumb']);
			$('.q_username').text(data['data']['u_username']);
			$('.q_user_code').text(data['data']['q_user_code']);
			$('.gonumber').text(data['data']['q_gonumber']);
			$('.opentime').text(data['data']['q_end_time']);
			$('.sd_title').text(data['data']['sd_title']);
			$('.sd_time').text(data['data']['sd_time']);
			$('.sd_zhan').text(data['data']['sd_zhan']);
			$('#shareContent').html(data['data']['sd_content']);
			$('#ReplyCount').text(data['comment_num']);
			
			var html = '';
			for(var c in data['comment']){
				html += '<li>';
				html += '<a class="fl u-comment-img comment_userindex" href="javascript:openItem(\'userindex\','+data['comment'][c]['sdhf_userid']+',function(id){localData.set(\'user_id\',id);});">';
				html += '<img data-original="'+config.upload_url+'/'+data['comment'][c]['u_thumb']+'" class="lazy"/></a>';
				html += '<div class="u-comment-r">';
				html += '<p class="z-comment-name"><a userindex="'+data['comment'][c]['sdhf_userid']+'" href="javascript:openItem(\'userindex\','+data['comment'][c]['sdhf_userid']+',function(id){localData.set(\'user_id\',id);});" class="blue comment_userindex">'+data['comment'][c]['u_username']+'</a></p>';
				html += '<p class="gray6"><span>'+data['comment'][c]['sdhf_content']+'</span></p>';
				html += '<p class="gray6"><span>'+data['comment'][c]['sdhf_time']+'</span></p>';
				html += '</div></li>';
			}
			$('#replyList').html(html);
			var imgs = '';
			if(data['data']['imgs']){
				for(var i in data['data']['sd_photolist']){
					imgs += '<p><img src="../image/default.png" data-original="'+config.upload_url+'/'+data['data']['sd_photolist'][i]+'" class="lazy"/></p>';
				}
			}else{
				imgs = '<p><img src="../image/default.png" data-original="'+config.upload_url+'/'+data['data']['sd_photolist']+'" class="lazy"/></p>';
			}
			$('#shareContent').after(imgs);
			setTimeout(lyzimg,50);
		}
	});
	
	//返回顶部
	$(window).scroll(function(){
		if($(window).scrollTop()>50){
			$("#btnTop").show();
		}else{
			$("#btnTop").hide();
		}
	});
	$("#btnTop").click(function(){
		$("body").animate({scrollTop:0},10);
	});	
	function addsuccess(dat){
		$("#pageDialogBG .Prompt").text("");
		var w=($(window).width()-255)/2,
			h=($(window).height()-45)/2;
		$("#pageDialogBG").css({top:h,left:w,opacity:0.8});
		$("#pageDialogBG").stop().fadeIn(1000);
		$("#pageDialogBG .Prompt").append('<s></s>'+dat);
		$("#pageDialogBG").fadeOut(1000);
	}
	
	$('.userindex').click(function(){
		var userid = $(this).attr('userindex');
		if(!userid) return;
		openItem('userindex',userid,function(id){
			localData.set('userid',id);
		});
	});
	
	//展开发表评论
	$("#btnComment").click(function(){
		if('{wc:$member}'){
			$(".m-comment").show();
		}else{
			addsuccess('请登录!');
		}		
	});
	//取消发表
	$("#btnCancel").click(function(){
		$(".m-comment").hide();
	});
	//发表评论
	$("#btnPublish").click(function(){
		var c=$("#comment").val();
		if(!c){
			addsuccess('不能为空!');
		}else if(c.length<3){
			addsuccess('字符不能少于3个!');
		}else{
			
			
			PostData(config.url+"/app.php?act=plajax&uid="+userinfo.uid,{content:c,sd_id:sd_id},function(data){

				if(data['status'] == 1){
					$('#ReplyCount').text(data['count']);
					var insert = '';
					insert += '<li>';
					insert += '<a class="fl u-comment-img comment_userindex" href="javascript:openItem(\'userindex\','+data['data']['sdhf_userid']+',function(id){localData.set(\'user_id\',id);});">';
					insert += '<img data-original="'+config.upload_url+'/'+data['data']['u_thumb']+'" class="lazy"/></a>';
					insert += '<div class="u-comment-r">';
					insert += '<p class="z-comment-name"><a href="javascript:openItem(\'userindex\','+data['data']['sdhf_userid']+',function(id){localData.set(\'user_id\',id);});" class="blue comment_userindex">'+data['data']['u_username']+'</a></p>';
					insert += '<p class="gray6"><span>'+data['data']['sdhf_content']+'</span></p>';
					insert += '<p class="gray6"><span>'+data['data']['sdhf_time']+'</span></p>';
					insert += '</div></li>';
					$('#replyList').append(insert);
					addsuccess('评论成功');
					lyzimg();
				}else{
					addsuccess('评论失败!');
				}
				$(".m-comment").hide();
			});
		}
	});
	
	//羡慕嫉妒恨
	GetJPData(config.url+'/app.php?act=xianmu&openstatus=1&uid='+userinfo.uid,{id:sd_id},function(data){
		if(data['status'] == 0){
			$("#emHits").addClass("z-btn-moodgray");
		}
	});
	
	$("#emHits").click(function(){
		$("#emHits").addClass("z-btn-moodgray");
		GetJPData(config.url+"/app.php?act=xianmu&uid="+userinfo.uid,
			{id:sd_id},
			function(data){
				if(data['status'] == 1){
					$("#emHits em").text(data['count']);					
				}else{
					
				}
			}
		);
	});
	
	//分享
	$("#btnShare").click(function(){
		var w=($(window).width()-300)/2,
			h=($(window).height()-100)/2;
		$("#pageDialog").css({top:h,left:w});
		$("#pageDialog").show();
	});
	$("#btnMsgCancel").click(function(){
		$("#pageDialog").hide();
	});
	$("#shareType li").click(function(){
		var n=$(this).index();
		$(".jiathis_style a").eq(n).click();
	});
	
	$('.iconline-refresh').click(function(){
		window.location.reload();
	});
	
});

};
</script>
</div>
</body>
</html>

<style>
#pageDialogBG{-webkit-border-radius:5px; width:255px;height:45px;color:#fff;font-size:16px;text-align:center;line-height:45px;}

</style>
<div id="pageDialogBG" class="pageDialogBG">
<div class="Prompt"></div>
</div>
<div id="pageDialog" class="pageDialog" style="width:300px; height:100px; position: fixed; display: none;">
	<div class="clearfix m-round f-share-tips"><div class="f-share-tit">请选择以下方式分享</div>
	<a id="btnMsgCancel" href="javascript:void(0)" class="f-share-Close"></a>
	<ul id="shareType" class="f-share-li">
		<li><a href="javascript:void(0);"><b class="z-sina"><s></s></b><em>新浪微博</em></a></li>
		<li><a href="javascript:void(0);"><b class="z-qq"><s></s></b><em>腾讯微博</em></a></li>
		<li><a href="javascript:void(0);"><b class="z-qzone"><s></s></b><em>QQ空间</em></a></li>
	</ul>
	<!-- JiaThis Button BEGIN -->
	<div class="jiathis_style" style="display:none;">	
		<a class="jiathis_button_tsina"></a>
		<a class="jiathis_button_tqq"></a>
		<a class="jiathis_button_qzone"></a>
	</div>
	<!-- JiaThis Button END -->
	</div> 
</div>